home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
drdobbs
/
1991
/
01
/
winthere.asc
< prev
next >
Wrap
Text File
|
1990-12-07
|
4KB
|
97 lines
_WINTHERE_
by Ben Myers
[LISTING ONE]
page 58,132
title WINTHERE, A program to test for the presence of Windows 3.0
subttl (C)Copyright 1990 Spirit of Performance, Inc.
; All Rights Reserved.
.list
; You may use any portion of this program for any purpose whatsoever, but
; you must include the above copyright in any program into which portions of
; this program are incorporated.
; Use Microsoft MASM 5.1 or later and Borland TLINK to build WINTHERE.COM.
; masm %1,%1.obj;
; tlink /x /t %1.obj,%1.com
; You may also use LINK and EXE2BIN to build WINTHERE.COM. MASM local
; reference operators @f, @b, and @@ are not handled correctly by Borland TASM.
; Equates used in this program
Multiplexor equ 2Fh ; DOS multiplexor interrupt
KbdIO equ 16h ; BIOS Keyboard interrupt
DOS equ 21h ; DOS function call interrupt
Terminate equ 4Ch ; DOS terminate function
PrintString equ 09h ; DOS print string function
CR equ 0dh ; Carriage Return.
LF equ 0ah ; Line Feed.
; Simple macro to display a text string with the DOS print string function
Display macro message
local amsg,around
mov dx,offset amsg ; Load offset of message
mov ah,PrintString ; DOS function code
int DOS
jmp short around ; jump around message text
amsg:
.errb <message> ; generate assembler error if no message
irp y,<message> ; repeat for each of y args in message list
db y
endm
db '$' ; terminate message with '$' as required
around:
endm
cseg segment public 'code'
assume cs:cseg
org 100h
Begin:
Display <"WINTHERE - (C)Copyright 1990 Spirit of Performance, Inc.",CR,LF>
; See if being executed from Windows 3.0 in enhanced mode.
mov ax,1600h ; Enhanced Windows multiplex signature.
int Multiplexor
test al,7fh ; Windows 386?
jnz Win_Enhanced ; Yes.
; See if being executed from Windows 3.0 in real or standard mode.
mov ax,4680h ; Multiplex signature...
int Multiplexor ; apparently when Win3 is not enhanced.
or ax,ax ; Windows 3.0 /r or /s?
jz @f ; Yes.
jmp Not_Enhanced_Win ; No.
@@:
Display <"WINTHERE has been run from Windows real or standard mode.",CR,LF>
jmp WrapUp
Win_Enhanced:
Display <"WINTHERE has been run from within Windows in enhanced mode.",CR,LF>
WrapUp:
Display <"Press any key to continue. . .",CR,LF>
xor ah,ah ; Read a keystroke.
int KbdIO
or ah,ah ; Extended scan code?
jnz @f ; No.
int KbdIO ; Read second half of extended character.
@@:
mov ah,Terminate ; Quit.
mov al,1 ; DOS exit code 1 to indicate error.
int DOS
Not_Enhanced_Win:
Display <"WINTHERE has not been run from within MS Windows.",CR,LF>
mov ah,Terminate ; Quit.
xor al,al ; Exit code 0, no error.
int DOS
; The interrupt mux call with ax=4680h is the one that Microsoft refuses to
; acknowledge, but it sure is there every time Windows is run in real or
; standard mode, and the mux interrupt vector points dead square in the middle
; of the Windows kernel, which then chains the mux interrupt elsewhere.
cseg ends
end Begin